package com.www.applyword.ui.home;

import android.text.TextUtils;
import android.widget.EditText;

import com.allen.library.SuperButton;
import com.www.applyword.Constants.Constants;
import com.www.applyword.R;
import com.www.applyword.base.BaseActivity;
import com.www.applyword.bean.LoginBean;
import com.www.applyword.http.CallBack;
import com.www.applyword.http.HttpClient;
import com.www.applyword.utils.SPUtil;
import com.www.applyword.utils.Utils;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * author : huang
 * date   : 2019/11/20 0020 14:13
 * version: 1.0
 */
public class CommentActivity extends BaseActivity {
    @BindView(R.id.et_info)
    EditText etInfo;
    @BindView(R.id.sb_tijiao)
    SuperButton sbTijiao;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.comment_activity);
        setTitle("评价");
    }

    @Override
    protected void loadData() {


    }



    @OnClick(R.id.sb_tijiao)
    public void onViewClicked() {
        if (TextUtils.isEmpty(etInfo.getText().toString().trim())){
            Utils.showToastSafe("请输入评价内容");
            return;
        }

        Map<String, Object> params = new HashMap<>();
        if (TextUtils.isEmpty(getIntent().getStringExtra("BusinessID"))){
            params.put("OrderItemsID",getIntent().getStringExtra("OrderItemsID"));
        }else {
            params.put("BusinessID",getIntent().getStringExtra("BusinessID"));
        }
        params.put("Content",etInfo.getText().toString().trim());
        params.put("UserID", SPUtil.getString(Constants.USERID));
        HttpClient.get(CommentActivity.this, Constants.COMMENT, params,new CallBack<LoginBean>() {
            @Override
            public void onSuccess(LoginBean result) {
                Utils.showToastSafe("评论成功");
                finish();
            }
        });
    }
}
